package service;

import dao.AdminBookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.AdminMessage;
import pojo.BookBorrow;
import pojo.BookMessage;
import pojo.UserMessage;

import java.util.List;
import java.util.Map;

/**
 * @author chen
 */
@Service
public class AdminBookServiceImpl implements AdminBookService {
    @Autowired
    private AdminBookMapper adminBookMapper;

    @Override
    public int addBook(BookMessage book) {
        return adminBookMapper.AddBook(book);
    }

    @Override
    public int deleteBook(String bookName) {
        return adminBookMapper.DeleteBook(bookName);
    }

    @Override
    public int UpdateBookMessage(BookMessage book) {
        return adminBookMapper.UpdateBookMessage(book);
    }

    @Override
    public List<BookMessage> getBooksByInfo(Map map) {
        return adminBookMapper.getBooksByInfo(map);
    }

    @Override
    public AdminMessage getAdmin(String name) {
        return adminBookMapper.getAdmin(name);
    }

    @Override
    public int getLends(String userName) {
        return adminBookMapper.getLends(userName);
    }

    @Override
    public BookMessage getBook(String bookName) {
        return adminBookMapper.getBook(bookName);
    }

    @Override
    public List<UserMessage> getAlluser() {
        return adminBookMapper.getAlluser();
    }

    @Override
    public List<UserMessage> getuser(String userName) {
        return adminBookMapper.getuser(userName);
    }

    @Override
    public List<BookBorrow> getAllLender(String readerName) {
        return adminBookMapper.getAllLender(readerName);
    }

    @Override
    public List<BookMessage> getAllBooks() {
        return adminBookMapper.getAllBooks();
    }

    @Override
    public int delete(String bookName, String readerName) {
        return adminBookMapper.delete(bookName, readerName);
    }

    @Override
    public AdminMessage getAdminMessage(String controllerName, String controllerPassword) {//登录
        return adminBookMapper.getAdminMessage(controllerName, controllerPassword);
    }

    @Override
    public int UpdateAdminMesssage(AdminMessage message) {
        return adminBookMapper.UpdateAdminMesssage(message);
    }

    @Override
    public List<BookBorrow> getAlllender() {
        return adminBookMapper.getAlllender();
    }
}
